package com.yin.jia.liang.service;


import com.yin.jia.liang.dao.GongGaoMapper;
import com.yin.jia.liang.entity.GongGao;
import com.yin.jia.liang.entity.GongGaoExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GongGaoService {

    @Autowired
    GongGaoMapper gongGaoMapper;

    public GongGao findById(Integer id) {
        return gongGaoMapper.selectByPrimaryKey(id);
    }

    public List<GongGao> find() {
        GongGaoExample ue = new GongGaoExample();
        ue.setOrderByClause("id desc");
        List<GongGao> g = gongGaoMapper.selectByExample(ue);

        return g;
    }

    public Integer save(GongGao gongGao) {
        int i = gongGaoMapper.insert(gongGao);
        return i;
    }

    public int update(GongGao gongGao) {
        int i = gongGaoMapper.updateByPrimaryKeySelective(gongGao);
        return i;
    }

    public Integer delete(Integer id) {
        return gongGaoMapper.deleteByPrimaryKey(id);
    }
}
